#define PACKET_SIZE 64

typedef BYTE		T0CON_T;
typedef BYTE		T1CON_T;
typedef BYTE		TMR0L_T;
typedef BYTE		TMR0H_T;
typedef BYTE		ADCON0_T;
typedef BYTE		ADCON1_T;
typedef BYTE		PACKET_ID_T;
typedef BYTE		POLL_ID_T;

typedef BYTE		CHUNK_ID;
typedef WORD		CHUNK_VALUE;
typedef BYTE		CHUNK_TIME;


typedef struct CHUNK_T
{
	CHUNK_ID		id;
	CHUNK_VALUE		value;
	CHUNK_TIME		time;
} CHUNK;

typedef struct CHUNK_ARRAY_T
{
	BYTE	length;
	CHUNK	data[(PACKET_SIZE-sizeof(BYTE))/sizeof(CHUNK)];
} CHUNK_ARRAY;

typedef struct POLL_T
{
	POLL_ID_T		pollId;
} ADC_POLL;

typedef struct CONFIG_OPTIONS_T
{
	T0CON_T			t0con;
	T1CON_T			t1con;
	ADCON0_T		adcon0;
	ADCON1_T		adcon1;
	TMR0L_T			tmr0l;
	TMR0H_T			tmr0h;
} CONFIG_OPTIONS;

typedef union DATA_KOMBI_T
{
	BYTE				bytes[PACKET_SIZE];
	CHUNK_ARRAY 		chunks;
	CONFIG_OPTIONS		coptions;
	ADC_POLL			poll;
} DATA_KOMBI_PACKET;

typedef struct HOST_PACKET_T
{
	PACKET_ID_T			id;
	DATA_KOMBI_PACKET	data;
} HOST_PACKET;

typedef enum INPACKET_ID_T {ADC_QUERY = 1, CONFIG_QUERY};
typedef enum OUTPACKET_ID_T {ADC = 1, CONFIG};
